package com.sanrenzu.chunbo.ui.vertical.fenlei;

import android.os.Handler;
import android.os.Looper;
import android.support.v4.view.PagerTabStrip;
import android.text.style.TtsSpan;

import com.sanrenzu.chunbo.bean.zxb.ShouYeDianJiBean;
import com.sanrenzu.chunbo.config.UrlConfig;

import java.util.Map;

import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;

/**
 * Created by My on 2016/9/1.
 */
public class FenLeiPersenterA implements FenLeiContractA.Persenter{

    private FenLeiContractA.View view;
    private FenLeiContractA.Modle modle;

    public FenLeiPersenterA(FenLeiContractA.View view){
        this.view=view;
        modle = new FenLeiModleA();
    }

    @Override
    public void getVerticalShouYe(Map<String, String> params) {
        modle.getVerticalShouYeDianJi(params,new Callback<ShouYeDianJiBean>() {
            @Override
            public void onResponse(Call<ShouYeDianJiBean> call, Response<ShouYeDianJiBean> response) {
                final ShouYeDianJiBean bean = response.body();
                Handler handler = new Handler(Looper.getMainLooper());
                handler.post(new Runnable() {
                    @Override
                    public void run() {
                        view.onGetVerticalDianJiTuPianBean(bean);
                    }
                });
            }
            @Override
            public void onFailure(Call<ShouYeDianJiBean> call, Throwable t) {

            }
        });
    }
}
